<%@page import="com.mmy.domain.hotel.THotelOrder"%> 
<%@page import="com.mmy.domain.hotel.THotelPlan"%> 
<%@page import="com.mmy.domain.hotel.VHotelPlan"%> 
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/WEB-INF/jsp/include1.jsp"></jsp:include>
<script src="js/qn_priceCalendar.js"></script>
<link rel="stylesheet" href="css/qn_priceCalendar.css">
<title>酒店预留信息</title>
</head>
<body>

	<div id="off-canvas-container" class="off-canvas-container">
		<jsp:include page="/WEB-INF/jsp/FrontHeader.jsp"></jsp:include>
		<div id="index-back">
		<main class="at-padding-large-bottom">
			<article>
				
				<section class="container">
					<div class="information ">
						
							<form >
							<h4 class="info-h4">
								<i class="fa fa-caret-right" aria-hidden="true"></i>新建酒店房间预留信息
							</h4>

							<div class="input-container  background">
							<textarea id="json" style="display:none"> ${json } </textarea>

							<div class="reserveTicket at-float-left">
							
							<h3>请选择房间与日期</h3>
							<div style="padding-left:40px;">
								<label for="HotelRoom">酒店房间</label>
								<input type="hidden" name="strHotelID" id="strHotelID" value="${iHotelID}">
								<select class="select-height input-select-vlign" id="HotelRoom" name="RoomName" onchange="selectRoom()">
								<option value="" <c:if test="${strRoomID==''}"> selected="selected"</c:if> >请选择房间</option>
								<c:forEach items="${lstHotelPlanRoom}" var="lstHotelPlanRoom" varStatus="status">
								
								<option value="${lstHotelPlanRoom.iRoomID}" <c:if test="${lstHotelPlanRoom.iRoomID eq strRoomID}"> selected="selected"</c:if> >${lstHotelPlanRoom.cRoomName}</option>
							
								</c:forEach>
							</select> <span class="mustWrite">*</span>
									<label for="myCalendar">使用日期</label>
									<input type="hidden" name="strRoomID" id="strRoomID" value="${strRoomID}">
										<input type="text" id="myCalendar" ></input><span
													class="mustWrite">*</span>
							</div>
							</div>		
							<div class="at-float-right" style="width:25%;border:2px solid #1eab3c;height:200px;padding:20px;">
								<h3>总价</h3>
								<label>￥</label><input style="border: 0px;" type="text" id="reservePrice" value="--" readonly></input>
			
							</div>
							
							<div id="showService">
												
								
						</div>
						<div id="showInfo">	
						
						</div>
							<center>
				
							<input type="hidden" id="strUserType" value="${tSysUser.getUserType() }" />
							<c:if test="${tSysUser.getUserType()!=0 }">
							<input  type="button" class="btn" value="确定" onclick="saveReserveHotel()" /> 
							</c:if>
								<c:if test="${tSysUser.getUserType()==0 }">
								
								<!-- 要作验证 -->
								<input  type="button" class="btn" value="去支付" onclick="" /> 
								</c:if>
								
									<input type="button"  class="btn" value="取消" onclick="rehidder()" />
								</center>
								</div>
						</form>
					</div>
				</section>
			</article>
		</main>
		</div>
		<jsp:include page="/WEB-INF/jsp/Footer.jsp"></jsp:include>
	</div>
	<jsp:include page="/WEB-INF/jsp/include2.jsp"></jsp:include>
	<!-- liys修改正则表达式  2020.12.14 -->
	<script type="text/javascript">
		
		var roomID = $("#HotelRoom").val();
		var json = $("#json").val();
		var list = JSON.parse(json);
		
		var tt=$("#myCalendar").qn_priceCalendar({
						date:new Date(list[0].date),
						dateInfoList:list,
						css:{
							top:$("#myCalendar").position().top+25,
							left:$("#myCalendar").position().left
							},
						minDate:list[0].date,
						maxDate:list[list.length-1].date,
						dateSelected:function(date){
						
							var datef = dateFormat("yyyy-MM-dd",date);
							$("#myCalendar").val(datef);
							$.ajax({
								url:"/mmy/queryplanhotel",
								type:"post",
								data:{
								"date":date,
								"roomID":roomID},
								
								success:function(list){

									$("#showService").html("");
									var data = list.service;
									var div=$("#showService");
									
									var div1=$("<div class='reserveTicket'></div>");
									
						var h3=$("<h3>酒店房间预定</h3>");
									var table = $("	<table class='info-table' id='standNum'></table>");
									
									
									for(var i=0;i<data.length;i++){
										var node=data[i];
										var tr=$("<tr id='tr"+i+"'></tr>")
								        var th1=$("<th>类型</th>");
								        var td1=$("<td> <input type='text' style='boder:0px;'  id='service"+i+"' value="+node.cService+" readonly/>  </td>");
								        var input=$("<input type='hidden' id='planID"+i+"' value="+node.iPlanID+" />");
								        td1.append(input);
								        var th2=$("<th>数量</th>");
								        var td2=$("<td></td>");
								        var select=$("<select id='planNum"+i+"' onchange='selectRoomOrderNum()'></select>");
								        var option=$(
								        "<option value='0'>0</option>"
								        +"<option value='1'>1</option>"
								        +"<option value='2'>2</option>"
								        +"<option value='3'>3</option>"
								        +"<option value='4'>4</option>"
								        +"<option value='5'>5</option>");
								        select.append(option);
								        td2.append(select);
								        tr.append(th1);
								        tr.append(td1);
								        tr.append(th2);
								        tr.append(td2);
								        table.append(tr);
									
									}
						div1.append(h3);
						div1.append(table);
						div.append(div1);
								}})
						
						}
					});
	
	function triggerAlert(){
		tt.trigger('click','#next');
		tt.find('#next').click();
	}
		
		function getActive(){
			var data = $('.calendar-box').calendarGetActive();
			$("#date").attr("value",data.date);
		}
		
		function selectRoom(){
			var iRoomID=$("#HotelRoom").val();
			var iHotelID=$("#strHotelID").val();
			var url = "/mmy/enterreservehotel?iRoomID=" + iRoomID+"&iHotelID="+iHotelID;
			window.location = url;
		}
	
	</script>
</body>

</html>